package com.group.medical.util;

import cn.hutool.jwt.JWTUtil;

import java.util.HashMap;

public class TokenUtil {

    /**
     * 生成令牌*/
    public static String createToken(String content){
        HashMap<String, Object> pyload=new HashMap<>();
        pyload.put("phone",content);
        pyload.put("ctime", System.currentTimeMillis());
        return JWTUtil.createToken(pyload,"lazyhabit".getBytes());
    }
    /**
     * 解析令牌*/
    public static String parseToken(String token){
        return JWTUtil.parseToken(token).getPayload("phone").toString();
    }
}
